#!/usr/bin/perl
use warnings;
use strict;
use Storable;

my $topic_dir = shift;
chdir $topic_dir or die "$!";
#for my $sub_dir (qw(BestFirst Accelerated FirstOrder)) {
for my $sub_dir (qw(Train)) {
    my $inFile = "$sub_dir/statistics";
    my $outFile = "$sub_dir/gnuplot.total";
    my @statis = @{ Storable::retrieve($inFile) };
    open OUT, "> $outFile" or die "$!";
    my ($count, $pos_count) = (0, 0);
    for (@statis) {
        $count++;
        $pos_count++ if $_ eq '+';
        print OUT $count, "\t", $pos_count, "\n";
    }
    close OUT;
}
print "Done!\n";
